import logging


app = None

def init(_app):
    global app
    app = _app

    logging.basicConfig(format='[%(asctime)s][%(levelname)s] %(pathname)s:%(lineno)d - %(message)s', level=logging.INFO)

def info(s):
    if app != None:
        app.logger.info(s)
    else:
        logging.info(s)

def warn(s):
    if app != None:
        app.logger.warning(s)
    else:
        logging.warning(s)

def error(s):
    if app != None:
        app.logger.error(s)
    else:
        logging.error(s)
